<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <a class="navbar-brand" href="/">Lithum知识社区</a>
    </div>

    <ul class="nav navbar-nav">
      {% for tab in tabs %}
      <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{{ tab.name }}
          <span class="caret"></span></a>
        <ul class="dropdown-menu">
          {% for tag in tab.tags %}
            <li><a href="/?tag={{ tag.id }}">{{ tag.name }}</a></li>
          {% endfor %}
        </ul>
      </li>
      {% endfor %}
    </ul>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="/">首页</a></li>
        {% if current_user and current_user.is_authenticated %}
        {% if current_user.is_admin %}
        <li><a href='/manage'>管理后台</a></li>
        {% endif %}
        <li><a href='/setting'>设置</a></li>
        <li><a href='/logout?next={{ request.path }}'>退出</a></li>
        {% else %}
        <li><a href='/register'>注册</a></li>
        <li><a href='/login'>登录</a></li>
        {% endif %}
      </ul>
    </div>
  </div>
</nav>